<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .parent {
            background: #ff8787;
            /* 对于行级元素的居中 */
            text-align: center;
        }
        
        .child {
            width: 300px;
            height: 300px;
            background-color: aquamarine;
            /* 转换为行内块级 */
            display: inline-block;
        }
    </style>
</head>

<body>
    <div class="parent">
        <div class="child"></div>
    </div>
</body>

</html>